﻿using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Web;

namespace BasicCMS.Content.Controllers
{
    public class ModelDynamicObject : DynamicObject
    {
        private IDictionary<string, object> _dic;
        public ModelDynamicObject(IDictionary<string,object> dic)
        {
            _dic = dic;
        }

        public override bool TryGetMember(GetMemberBinder binder, out object result)
        {
            var name = binder.Name;

            return _dic.TryGetValue(name, out result);
        }
    }
}